import { createBrowserRouter } from 'react-router-dom';
import { lazy, createElement } from 'react';

// 使用React.lazy进行代码分割
const Home = lazy(() => import('@pages/Home'));
const VideoList = lazy(() => import('@pages/VideoList'));
const VideoPlayer = lazy(() => import('@pages/VideoPlayer'));

// 定义路由配置
const router = createBrowserRouter([
  {
    path: '/',
    element: createElement(Home)
  },
  {
    path: '/videos',
    element: createElement(VideoList)
  },
  {
    path: '/player/:id',
    element: createElement(VideoPlayer)
  },
]);

export default router;